/**
 * @projectName study_java
 * @package chapter_06
 * @className chapter_06.Test
 */
package Decorator;

import Decorator.son.BeachPants;
import Decorator.son.Shirt;
import Decorator.son.SuitPants;
import Decorator.son.Tshirt;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Test
 * @description 测试装饰模式
 * @author answer_wx
 * @date 2022/6/26 17:00
 * @version 1.0
 */
public class Test {
    public static void main(String[] args) {
        Person person = new Person("帅哥");
        System.out.println("第一种装扮！！！");
        Tshirt tshirt = new Tshirt();
        SuitPants suitPants = new SuitPants();
        tshirt.decorator(person);// 3、传进去实现IShow的类
        suitPants.decorator(tshirt);// 2、传进去实现IShow的类
        suitPants.show();// 1、先调用这个show，打印SuitPants类的中show，执行super方法
        System.out.println("第二种装扮！！！");
        BeachPants beachPants = new BeachPants();
        Shirt shirt = new Shirt();
        beachPants.decorator(person);
        shirt.decorator(beachPants);
        shirt.show();

    }
}